<?php

namespace common\models\hospital;

use Yii;

/**
 * This is the model class for table "{{%in_hospital}}".
 *
 * @property int $id
 * @property int|null $project_id 项目id
 * @property string|null $card_id
 * @property int|null $type 1 = 住院, 2 = 出院
 * @property int|null $event_time 住院/出院 时间戳
 * @property int|null $serial_no
 * @property int|null $clinic_name 诊室名
 * @property string|null $day
 * @property int|null $created_at
 * @property int|null $updated_at
 */
class InHospital extends \common\models\BaseModel
{

    const TYPE_IN = 1; // 入院
    const TYPE_OUT = 2; // 出院

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%in_hospital}}';
    }

    public static function getDb()
    {
        return Yii::$app->db3;
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['type', 'event_time', 'serial_no', 'created_at', 'updated_at'], 'integer'],
            [['day'], 'safe'],
            [['card_id'], 'string', 'max' => 50],
            [['id'], 'unique'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'hospital' => 'Hospital',
            'card_id' => 'Card ID',
            'type' => 'Type',
            'event_time' => 'Event Time',
            'serial_no' => 'Serial No',
            'day' => 'Day',
            'created_at' => 'Created At',
            'updated_at' => 'Updated At',
        ];
    }
}
